Compiling Lazy Functional Programs Based on the Spineless Tagless G-Machine for the Java Virtual Machine
نویسندگان
چکیده
A systematic method of compiling lazy functional programs based on the Spineless Tagless G-machine (STGM) is presented for the Java Virtual Machine (JVM). A new specification of the STGM, which consists of a compiler and a reduction machine, is presented; the compiler translates a program in the STG language, which is the source language for the STGM, into a program in an intermediate language called L-code, and our reduction machine reduces the L-code program into an answer. With our representation for the reduction machine by the Java language, an L-code program is translated into a Java program simulating the
منابع مشابه
Mobile Haskell: Compiling Lazy Functional Programs for the Java Virtual Machine
This paper shows how lazy functional programs can be made mobile by compiling them for the Java Virtual Machine. The Haskell compiler it describes is based on the h,Gi-machine, which is designed for implementing lazy functional languages on parallel processors. Although this is not the obvious thing to do, it leads to a particularly elegant set of translation rules. Sadly though, the speed of t...
متن کاملPutting the Spine Back in the Spineless Tagless G-Machine: An Implementation of Resumable Black-Holes
Interrupt handling is a tricky business in lazy functional languages: we have to make sure that thunks that are being evaluated can be halted and later restarted if and when they are required. This is a particular problem for implementations which use black-holing. Black-Holing deliberately makes it impossible to revert such thunks to their original state to avoid a serious space leak. Interact...
متن کاملProfiling Lazy Functional Programs
Prooling tools, which measure and display the dynamic space and time behaviour of programs, are essential for identifying execution bottlenecks. A variety of such tools exist for conventional languages, but almost none for non-strict functional languages. There is a good reason for this: lazy evaluation means that the program is executed in an order which is not immediately apparent from the so...
متن کاملImplementing the Rewriting Computational Model of Escher
In this paper we discuss implementation issues concerned with a new abstract machine for executing functional logic programs. This machine supports a pure rewriting computational model in the style of the programming language Escher. It is based on a simpli ed version of the Spineless Tagless G-Machine which was developed for the implementation of higher-order, lazy, purely functional languages...
متن کاملImplementing Lazy Functional Languages on Stock Hardware: The Spineless Tagless G-Machine
The Spineless Tagless G-machine is an abstract machine designed to support nonstrict higher-order functional languages. This presentation of the machine falls into three parts. Firstly, we give a general discussion of the design issues involved in implementing non-strict functional languages. Next, we present the STG language, an austere but recognisably-functional language, which as well as a ...
متن کامل